package game.players.user.movements;

import com.uqbar.vainilla.DeltaState;
import com.uqbar.vainilla.appearances.Sprite;
import com.uqbar.vainilla.events.constants.Key;

import game.players.SoccerPlayer;
import game.players.user.WithoutBallUser;

public class WithoutBallStationaryUser extends WithoutBallUser {

	public WithoutBallStationaryUser(SoccerPlayer player) {
		super(player);
		this.getPlayer().setAppearance(Sprite.fromImage("/images/goal3_caminando2.png").crop(0, 1, 34, 65).scale(1.5));
	}

	@Override
	public void update(DeltaState deltaState) {
		if (deltaState.isKeyBeingHold(Key.LEFT))
			this.getPlayer().setState(new WithoutBallLeftMovingUser(this.getPlayer(), -this.getPlayer().getMovementSpeed(), 0));
			
		if (deltaState.isKeyBeingHold(Key.RIGHT))
			this.getPlayer().setState(new WithoutBallRightMovingUser(this.getPlayer(), this.getPlayer().getMovementSpeed(), 0));
		
		if(deltaState.isKeyBeingHold(Key.UP))
			this.getPlayer().setState(new WithoutBallUpMovingUser(this.getPlayer(), 0, -this.getPlayer().getMovementSpeed()));
		
		if(deltaState.isKeyBeingHold(Key.DOWN))
			this.getPlayer().setState(new WithoutBallDownMovingUser(this.getPlayer(), 0, this.getPlayer().getMovementSpeed()));
		
		super.update(deltaState);
	}

	@Override
	public boolean isRight() {
		return true;
	}
}
